package com.irs.controller;

import com.irs.pojo.Repair;
import com.irs.service.RepairService;
import com.irs.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class RepairController {

    @Autowired
    private RepairService repairService;


    @RequestMapping("/manger/dispatch")
    public  String dispatch(){
        return "page/repair/dispathch";
    }

    @GetMapping("/manger/dispatch/list")
    @ResponseBody
    public Object dispathchlist(){
        List<Repair> repairList=repairService.select(new Repair());
        return ResultUtil.ok(repairList,repairList.size());
    }


    @RequestMapping("/manger/repair")
    public String repir(){
        return "page/repair/repair";
    }

    @GetMapping("/manger/delete")
    @ResponseBody
    public String  delete(int id){
        int i=repairService.delete(id);
        return "page/repair/repair";
    }

}